// JavaScript Document

//for login form
function loginform() {
	errors=false;
	errorMsg = "";
	d=document.login;
	// basic check required fields
	if (d.uname.value == "") {
		errorMsg +="Please enter your Username.\n";
		errors=true;
	}
	else if (d.pass.value == "") {
		errorMsg +="Please enter your Password.\n";
		errors=true;
	}
	// message if errors exist
	if (errors){
		alert(errorMsg);
		return !errors;
	}
}

//for register form
function registform() {
	errors=false;
	errorMsg = "";
	d=document.registerf;
	// basic check required fields
	if (d.txtUser.value == "") {
		errorMsg +="Please enter your User ID.\n";
		errors=true;
	}
	else if (d.txtName.value == "") {
		errorMsg +="Please enter your Name.\n";
		errors=true;
	}
	else if (d.txtPassword.value == "") {
		errorMsg +="Please enter your password.\n";
		errors=true;
	}
	// message if errors exist
	if (errors)
		alert(errorMsg);
	return !errors;
}

//for feedback form
function checkform() {
	errors=false;
	errorMsg = "";
	d=document.feedback_form;
	// basic check required fields
	if (d.fname.value == "") {
		errorMsg +="Please enter your name.\n";
		errors=true;
	}
	else if (d.fphone.value == "e.g. 845800600") {
		errorMsg +="Please enter your phone.\n";
		errors=true;
	}
	else if (d.femail.value == "") {
		errorMsg +="Please enter your email.\n";
		errors=true;
	}
	// message if errors exist
	if (errors)
		alert(errorMsg);
	return !errors;
}

//for feedback form
function checkORform() {
	Msg = "Your order is made successfully! Thanks! Have a Good Day!";
	alert(Msg);
	return true;
}
